import React, { Component } from "react";

class Child extends Component {
  // 当接受到的props的值发生改变的时候触发
  // 用不到被废弃
  UNSAFE_componentWillReceiveProps() {
    console.log("child componentWillReceiveProps");
  }

  render() {
    console.log("child render");
    return <div>child子组件 - {this.props.count}</div>;
  }

  shouldComponentUpdate() {
    console.log("child shouldComponentUpdate");
    return true;
  }

  UNSAFE_componentWillUpdate() {
    console.log("child componentWillUpdate");
  }

  componentDidUpdate() {
    console.log("child componentDidUpdate");
  }
}

export default Child;
